        SOCs = 1:-0.05:0;
        Us = [4.20 4.12 4.04 4.00...
              3.94 3.87 3.81 3.77...
              3.71 3.69 3.67 3.63...
              3.62 3.60 3.57 3.55...
              3.52 3.50 3.47 3.35...
              3.03];

        
        SOC = rand(1,1e6);
        
        tic;
        interp1(SOCs,Us,SOC,'spline');
        toc;
        
        tic;
        interp1(SOCs,Us,SOC,'pship');
        toc;
        
        SOCs_fine = linspace(1, 0, 1e3);
        Us_fine = interp1(SOCs,Us,SOCs_fine,'spline');
        
        tic;
        interp1(SOCs_fine,Us_fine,SOC);
        toc;
        
% %         General model Sin6:
% %      f(x) =  
% %                     a1*sin(b1*x+c1) + a2*sin(b2*x+c2) + a3*sin(b3*x+c3) + 
% %                     a4*sin(b4*x+c4) + a5*sin(b5*x+c5) + a6*sin(b6*x+c6)
% % Coefficients (with 95% confidence bounds):
% %        a1 =       6.882  (-2.898e+04, 2.899e+04)
% %        b1 =       2.473  (-3751, 3756)
% %        c1 =      0.1061  (-1981, 1981)
% %        a2 =       3.232  (-2.896e+04, 2.897e+04)
% %        b2 =       3.986  (-6194, 6202)
% %        c2 =       2.432  (-3384, 3389)
% %        a3 =      0.1212  (-106.4, 106.6)
% %        b3 =       13.34  (-700.2, 726.9)
% %        c3 =      0.5217  (-424.2, 425.2)
% %        a4 =     0.08659  (-34.35, 34.52)
% %        b4 =       17.88  (-3702, 3738)
% %        c4 =       1.135  (-1998, 2000)
% %        a5 =      0.1057  (-1101, 1101)
% %        b5 =       24.34  (-7608, 7657)
% %        c5 =      0.8703  (-3928, 3930)
% %        a6 =     0.07762  (-1138, 1138)
% %        b6 =       25.34  (-5685, 5735)
% %        c6 =       3.501  (-2910, 2917)

       a1 =       6.882;
       b1 =       2.473;
       c1 =      0.1061;
       a2 =       3.232;
       b2 =       3.986;
       c2 =       2.432;
       a3 =      0.1212;
       b3 =       13.34;
       c3 =      0.5217;
       a4 =     0.08659;
       b4 =       17.88;
       c4 =       1.135;
       a5 =      0.1057;
       b5 =       24.34;
       c5 =      0.8703;
       a6 =     0.07762;
       b6 =       25.34;
       c6 =       3.501;
       
     x = SOC;
     
     tic;
     y = a1*sin(b1*x+c1) + a2*sin(b2*x+c2) + a3*sin(b3*x+c3) + ...
            a4*sin(b4*x+c4) + a5*sin(b5*x+c5) + a6*sin(b6*x+c6);
     toc;
     
       